home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / lib / obsolete / rmf.pro < prev    next >
Encoding:
Text File  |  1997-07-08  |  1.7 KB  |  64 lines

  1. ; $Id: rmf.pro,v 1.2 1997/01/15 04:02:19 ali Exp $
  2. ;
  3. ; Copyright (c) 1991-1997, Research Systems, Inc.  All rights reserved.
  4. ;       Unauthorized reproduction prohibited.
  5.  
  6. ;+
  7. ; NAME:
  8. ;    RMF
  9. ; PURPOSE:
  10. ;    Perform formatted input of matrices stored in the IMSL/IDL
  11. ;    linear algebra storage scheme from the specified file.
  12. ; CATEGORY:
  13. ;    Linear Algebra
  14. ; CALLING SEQUENCE:
  15. ;    RMF, UNIT, A [, Rows, Columns]
  16. ; INPUTS:
  17. ;    Unit - The input file unit.
  18. ;    E1, ... E10 - Expressions to be output. These can be scalar or
  19. ;        array and of any type.
  20. ; OUTPUTS:
  21. ;    Input is written to the file specified by unit.
  22. ; COMMON BLOCKS:
  23. ;    None.
  24. ; MODIFICATION HISTORY:
  25. ;    13, September 1991, Written by AB (RSI), Mike Pulverenti (IMSL)
  26. ;-
  27.  
  28. pro RMF, unit, A, rows, columns, double=dbl, complex=cmplx, format = format
  29.  
  30. on_error, 2        ; Return to caller on error
  31.  
  32. n = n_params()
  33. if (n ne 2) and (n ne 4) then message, 'Wrong number of arguments."
  34.  
  35. ;       If Rows and Columns were not given, then make sure a is
  36. ;       defined.
  37. s = size(a)
  38. if ((n eq 2) and (s(0) eq 0))  then message, 'Argument must be defined as an array if Rows and Columns are not supplied.'
  39. ;
  40. ;       Only read in 1-D and 2-D arrays.
  41. if ((n eq 2) and(s(0) gt 2)) then message, 'Array has too many dimensions.'
  42.  
  43. if (n eq 2) then begin
  44.     a = transpose(a)
  45.     s = size(a)
  46.     l_columns = s(1)
  47.     if (s(0) eq 1) then l_rows=1 else l_rows=s(2)
  48.     type = s(s(0)+1)
  49. endif else begin
  50.     l_rows = rows
  51.     l_columns = columns
  52.     dbl = keyword_set(dbl)
  53.     cmplx = keyword_set(cmplx)
  54.     a = make_array(l_columns, l_rows, double= keyword_set(dbl), $
  55.            complex=keyword_set(cmplx))
  56. endelse
  57.  
  58. if keyword_set(format) then readf, unit, a, format = format $
  59. else readf, unit, a
  60.  
  61. a = transpose(a)
  62.  
  63. end
  64.